<!doctype html>
<html>
<?php echo $this->fetch('head.html'); ?>

<body>
 
<div class="header" >
    <a class="left-btn pointer" href="<?php if ($this->_var['qdadmin']): ?><?php echo $this->_var['appkoudai']; ?>?m=koudai_qd<?php else: ?><?php echo $this->_var['appkoudai']; ?>?m=koudai_order<?php endif; ?>"><span class="iconfont icon-back"></span></a> 
    <div class="title">订单详情</div>
     
  </div>
    
  <div class="orderhd">
  		订单编号：<?php echo $this->_var['data']['orderno']; ?>
        订单状态：<span style="color:red"><?php echo $this->_var['order_status_list'][$this->_var['data']['status']]; ?></span>
  </div>
  
   <div class="plist np">
    <?php $_from = $this->_var['order_product']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'p');if (count($_from)):
    foreach ($_from AS $this->_var['p']):
?>
    <div class="item">
      <div class="g-sd1"><a href="/index.php?m=koudai_product&a=show&koudaiid=<?php echo $this->_var['p']['koudaiid']; ?>&id=<?php echo $this->_var['p']['id']; ?>" target="_blank"><img src="<?php echo images_site($this->_var['p']['imgurl']); ?>.100x100.jpg" width="40" /></a></div>
      <div class="g-mn1">
      	<div class="g-mn1c">
     		 <div class="tit"><a href="/index.php?m=koudai_product&a=show&koudaiid=<?php echo $this->_var['p']['koudaiid']; ?>&id=<?php echo $this->_var['p']['id']; ?>" target="_blank"><?php echo $this->_var['p']['title']; ?></a></div>
        
        <div class="row-price">￥<?php echo $this->_var['p']['order_price']; ?>&nbsp;&nbsp;&nbsp; <span class="amount">x <?php if ($this->_var['p']['amount_send']): ?><?php echo $this->_var['p']['amount_send']; ?><?php else: ?><?php echo $this->_var['p']['amount']; ?><?php endif; ?></span> </div>
        
        </div>
       </div>
    </div>
    <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
   </div>
   <div class="h10"></div>
   <div class="kdtotalbox">
  		<div class="l">共<span id="total_num"><?php echo $this->_var['data']['total_num']; ?></span>件</div>
        <div class="r">合计：￥<span id="gys_money"><?php echo $this->_var['data']['money']; ?></span>元</div>
  </div>
  <div style="padding:10px; border-bottom:1px solid #ddd; margin-bottom:5px;">备注：<?php echo $this->_var['data']['comment']; ?></div>
  
  <table class="table-addr">
  	<tr>
    	<td class="t1">姓名 </td>
        <td><?php echo $this->_var['addr']['truename']; ?></td>
    </tr>
    
    <tr>
    	<td class="t1">电话 </td>
        <td><a href="tel:<?php echo $this->_var['addr']['telephone']; ?>"><?php echo $this->_var['addr']['telephone']; ?></a></td>
    </tr>
    
    <tr>
    	<td class="t1">地址 </td>
        <td><?php echo $this->_var['addr']['p_c_t']; ?>  宿舍：<?php echo $this->_var['addr']['sushe']; ?>  <?php echo $this->_var['addr']['address']; ?></td>
    </tr>
    
  </table>
  
  <table class="table-addr">
  	<tr>
    	<td class="t2">订单类型 </td>
        <td><?php if ($this->_var['data']['fenqi'] == 0): ?>普通订单<?php elseif ($this->_var['data']['fenqi'] == 1): ?>个人口袋<?php else: ?>宿舍口袋<?php endif; ?></td>
    </tr>
   <tr>
    	<td class="t2">下单时间 </td>
        <td><?php echo date("Y-m-d H:i:s",$this->_var['data']['dateline']); ?></td>
    </tr>
    
     <tr>
    	<td class="t2">付款方式 </td>
        <td><?php echo $this->_var['order_ispay'][$this->_var['data']['ispay']]; ?> <?php if ($this->_var['data']['paytype'] == 'wxpay'): ?>微信支付<?php elseif ($this->_var['data']['paytype'] == 'alipay'): ?>支付宝<?php endif; ?>   <?php if ($this->_var['data']['fenqi']): ?>额度支付<?php endif; ?></td>
    </tr>
    
    <tr>
    	<td class="t2">优惠额</td>
        <td><?php echo $this->_var['data']['coupon_money']; ?></td>
    </tr>
    
  </table>
  <div class="clearfix"></div>
   
  
  
   
  <?php if ($this->_var['data']['status'] == 0): ?>
  <form method="post" action="<?php echo $this->_var['appkoudai']; ?>?m=koudai_order&a=confirm" class="form form-inline ">
    <input type="hidden" name="order_id" value="<?php echo $this->_var['data']['order_id']; ?>" />
    <table class="table table-bordered">
      <tr>
        <td width="40"> 订单<br />
          确认 </td>
        <td><div class="input-row">
            <label>操作日志</label>
            <input type="text" name="content" value="<?php echo $this->_var['admin']['username']; ?>确认订单了" class="w98" />
          </div>
          <button type="submit" class="btn btn-row btn-success">确认下单</button></td>
      </tr>
    </table>
  </form>
  <?php endif; ?>
  <?php if ($this->_var['data']['status'] == 2): ?>
  <form method="post" action="<?php echo $this->_var['appkoudai']; ?>?m=koudai_order&a=send" class="form form-inline ">
    <input type="hidden" name="order_id" value="<?php echo $this->_var['data']['order_id']; ?>" />
    <table class="table table-bordered">
      <tr>
        <td  width="40"> 修改<br />
          物流 </td>
        <td><div class="input-row">
            <label>联系电话</label>
            <input type="text" name="kdy_telephone" value="<?php if ($this->_var['data']['kdy_telephone']): ?><?php echo $this->_var['data']['kdy_telephone']; ?><?php else: ?><?php echo $this->_var['shop']['telephone']; ?><?php endif; ?>">
            <br>
          </div>
          <div class="input-row">
            <label>物流信息</label>
            <input type="text" name="shipping_info" value="<?php echo $this->_var['data']['shipping_info']; ?>" class="w98" />
          </div>
          <div class="input-row">
            <label>操作日志</label>
            <input type="text" name="content" value="<?php echo $this->_var['admin']['username']; ?>确认发货了" class="w98" />
          </div>
          <button type="submit" class="btn btn-row btn-success">确认修改</button></td>
      </tr>
    </table>
  </form>
  <?php endif; ?>
  
  <?php if ($this->_var['data']['status'] == 1): ?>
  <form method="post" action="<?php echo $this->_var['appkoudai']; ?>?m=koudai_order&a=send" class="form form-inline ">
    <input type="hidden" name="order_id" value="<?php echo $this->_var['data']['order_id']; ?>" />
    <table class="table table-bordered">
      <tr>
        <td  width="40"> 确认<br />
          发货 </td>
        <td><div class="input-row">
            <label>联系电话</label>
            <input type="text" name="kdy_telephone" value="<?php if ($this->_var['data']['kdy_telephone']): ?><?php echo $this->_var['data']['kdy_telephone']; ?><?php else: ?><?php echo $this->_var['shop']['telephone']; ?><?php endif; ?>">
            <br>
          </div>
          <div class="input-row">
            <label>物流信息</label>
            <input type="text" name="shipping_info" value="<?php echo $this->_var['data']['shipping_info']; ?>" class="w98" />
          </div>
          <div class="input-row">
            <label>操作日志</label>
            <input type="text" name="content" value="<?php echo $this->_var['admin']['username']; ?>确认发货了" class="w98" />
          </div>
          <button type="submit" class="btn btn-row btn-success">确认发货</button></td>
      </tr>
    </table>
  </form>
  <?php endif; ?>
  <?php if ($this->_var['data']['status'] == 2 && $this->_var['data']['isreceived'] == 2): ?>
  <form method="post" action="<?php echo $this->_var['appkoudai']; ?>?m=koudai_order&a=finish" class="form form-inline " onsubmit="return confirm('订单确认完成后订单不能再编辑，确认完成吗？');">
    <input type="hidden" name="order_id" value="<?php echo $this->_var['data']['order_id']; ?>" />
    <table class="table table-bordered">
      <tr>
        <td width="40"> 订单<br />
          完成 </td>
        <td><div class="input-row">
            <label>操作日志</label>
            <input type="text" name="content" value="<?php echo $this->_var['admin']['username']; ?>确认完成了" class="w98" />
          </div>
          <button type="submit" class="btn btn-row btn-success">确认完成</button></td>
      </tr>
    </table>
  </form>
  <?php endif; ?>
  <?php if ($this->_var['data']['status'] == 0): ?>
  <form method="post" action="<?php echo $this->_var['appkoudai']; ?>?m=koudai_order&a=cancel" class="form form-inline " onsubmit="return confirm('订单取消后不可恢复，并且会将订单金额返还给客户，确认取消吗？');">
    <input type="hidden" name="order_id" value="<?php echo $this->_var['data']['order_id']; ?>" />
    <table class="table table-bordered">
      <tr>
        <td  width="40"> 取消<br />
          订单 </td>
        <td><div class="input-row">
            <label>原因</label>
            <input type="text" name="message" value="" class="w98" />
          </div>
          <div class="input-row">
            <label>操作日志</label>
            <input type="text" name="content" value="<?php echo $this->_var['admin']['username']; ?>取消订单了" class="w98" />
          </div>
          <button type="submit" class="btn btn-row btn-success">订单取消</button></td>
      </tr>
    </table>
  </form>
  <?php endif; ?>
  
  </div>
</div>
<?php echo $this->fetch('footer.html'); ?>
</body>
</html>
